Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

badblocks: fix status output when bb found #154

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LaurentChardon
Copy link

Fixes garbled output when -vv parameter is used and a bad block is found.

Output from test with bad blocks 1024 and 2048.
Before:

$ sudo misc/badblocks -vv /dev/sda1
Checking blocks 0 to 204799
Checking for bad blocks (read-only test): 102450% done, 0:00 elapsed. (0/0/0 errors)
204800% done, 0:00 elapsed. (1/0/0 errors)
done                                                 
Pass completed, 2 bad blocks found. (2/0/0 errors)

After:

$ sudo misc/badblocks -vv /dev/sda1
Checking blocks 0 to 204799
Checking for bad blocks (read-only test): 1024                                                                                                                           
2048                                                                                                                           
done                                                 
Pass completed, 2 bad blocks found. (2/0/0 errors)

I moved the function bb_output because it uses print_status that was defined later. The changes in it are where the if (v_flag > 1) blocks are, lines 464-470 and 475-476.

I could have added a function prototype for print_status instead of moving bb_output but that's not done for any other function. I could have added prototypes for all functions instead. I didn't do it so as not to modify the code too much, but let me know if you prefer that I do that.

Fixes garbled output when -vv parameter is used and a bad block is found.

Signed-off-by: Laurent Chardon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant